#define _CRT_SECURE_NO_WARNINGS 1

#include<iostream>
#include<vector>
#include<string>
#include<stack>

using namespace std;

int main()
{
	string s;
	stack<string> st;
	while (cin >> s)
	{
		st.push(s);
	}
	int ret = 0;
	while (st.size())
	{
		if (st.top() == "and" || st.top() == "or" || st.top() == "not")
		{
			cout << "error"; exit(0);
		}
		else
		{
			int num1 = st.top() == "true" ? 1 : 0; st.pop();
			if (st.top() == "true" || st.top() == "fale")
			{
				cout << "error"; exit(0);
			}
			else
			{
				string tmp = st.top(); st.pop();
				if (tmp == "not")
				{
					ret = num1 == 1 ? 0 : 1; st.push(ret == 1 ? "true" : "false");
				}
				else
				{
					if (st.top() == "and" || st.top() == "or" || st.top() == "not")
					{
						cout << "error"; exit(0);
					}
					else
					{
						int num2 = st.top() == "true" ? 1 : 0; st.pop();
						if (tmp == "and") ret = num1 && num2, st.push(ret == 1 ? "true" : "false");
						else ret = num1 || num2, st.push(ret == 1 ? "true" : "false");;
					}
				}
			}
		}
	}
	if (ret == 1)
		cout << "true";
	else cout << "false";
	return 0;
}
